<template>
  <div>
    <el-table
      :data="arr"
      style="width: 100%; margin-bottom: 20px"
      row-key="id"
      border
      default-expand-all
      :tree-props="{ children: 'children' }"
    >
      <el-table-column prop="id" label="用户编号" sortable width="180">
        
      </el-table-column>
      <el-table-column prop="nickname" label="昵称" sortable width="180">
      </el-table-column>
       <el-table-column prop="phone" label="手机号" sortable width="180">
      </el-table-column>
      <el-table-column label="状态">
        <template slot-scope="scope">
          <el-button type="primary" 
           v-if="scope.row.status == 1"   
            >启用</el-button
          >
          <el-button type="info"  v-else
            >禁用</el-button
          >
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button type="primary" @click="edit(scope.row.uid)" 
            >编辑</el-button 
          >
        </template>
      </el-table-column>
    </el-table>
    <form-vue :info="info" ref="form" @init="init"></form-vue>
  </div>
</template>
<script>
import formVue from "./components/form.vue";
import { mapGetters, mapActions } from "vuex";
import { reqmemberlist } from '../../http/api';
export default {
  components:{
    formVue
  },
  mounted() {
      this.init()
  },  
  data() {
      return {
        arr:[],
        info:{
          isshow:false
        }
      }
    },
  computed: {
    ...mapGetters({}),
  },
  methods: {
    ...mapActions({}),
    edit(id){
      this.info.isshow = true
      console.log(id);
      this.$refs.form.getOne(id)
    },
    init(){
      reqmemberlist().then(res => {
      // console.log(res);
      this.arr = res.data.list
    })
    }
  }
};
</script>
<style scoped lang="less">

</style>